package com.example.birdfriends.service.impl;

import com.example.birdfriends.dao.ReadDao;
import com.example.birdfriends.pojo.read.Reader;
import com.example.birdfriends.service.ReadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ReadServiceImpl implements ReadService {
    @Autowired
    private ReadDao readDao = null;

    @Override
    public int addReader(Reader reader) {
        return readDao.insertReader(reader);  // 用户阅读帖子，插入一个阅读数据项
    }

    @Override
    public List<Long> findReadersByPid(Long pid) {
        return readDao.findReadersByPid(pid);
    }

    @Override
    public Long findReadUidByRid(Long rid) {
        return readDao.findReadUidByRid(rid);
    }

    @Override
    public List<Long> findUserReadPostIds(Long uid) {
        return readDao.findUserReadPostIdList(uid);  // 查找该用户阅读过的所有帖子
    }
}
